// pswd_chk.js
//   An example of input password checking, using the submit 
//   event
     
// The event handler function for password checking

function chkPasswords() { 
  var init = document.getElementById("initial");
  var sec = document.getElementById("second");
  var thr = document.getElementsByName("submit")[0];
  if (init.value == "") {
    alert("You did not enter a password \n" +
          "Please enter one now");
    thr.setAttribute("disabled",true);
    return false;
  }
  if(init.value!=""&&sec.value!=""){
    if (init.value != sec.value) {
      alert("The two passwords you entered are not the same \n" +
            "Please re-enter both now");
      sec.value = "";
     return false;
    } else{
      return true;
    }
  }
}

function checkif(){
  window.setInterval(function(){
    if(document.getElementById('initial').value != ''){
      if(document.getElementById('initial').value != document.getElementById('second').value){
        document.getElementsByName('submit')[0].setAttribute("disabled",true);
      }
     else document.getElementsByName('submit')[0].removeAttribute("disabled");
    }
  },100);
}


